package  wangyi;
/*
* @Author: wanghongfucoder
* @Date:   2017-04-12 11:23:10
* @Last Modified by:   wanghongfucoder
* @Last Modified time: 2017-04-12 17:54:16
*/
import java.util.Arrays;
import java.util.Scanner;
public class DoubleCPU {
	
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int size=in.nextInt();
		int[] length=new int[size];
		int sum=0;
		for (int i=0; i<size; i++) {
			length[i]=in.nextInt();
			sum+=length[i];
		}
		int  half=sum/2;
        int  avrange=sum/size;
		int leftrange=0;
		int rightrange=0;
        Arrays.sort(length);
        if (sum-length[size-1]<=half) {
            System.out.println(length[size-1]);
        }else{
            
        }
	}
}
